package priv.yiyuan.example.design.flyweight;

/**
 * 文档资源
 * <p>
 * 享元模式-具体享元
 *
 * @author YiYuan
 * @data 2025/9/16
 * @apoNote
 */
public class DocumentResource implements CourseResource {

    private final String type;

    public DocumentResource(String type) {
        this.type = type;
        System.out.println("创建了一个新的文档资源对象: " + type);
    }

    @Override
    public void preview(String extrinsicState) {
        System.out.println("正在预览 " + type + " 文档, 页码: " + extrinsicState);
    }

    @Override
    public String getType() {
        return type;
    }
}
